<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="com.lihuanyu.upcOA.conn.databaseUtil" %>
<%--
  Created by IntelliJ IDEA.
  User: skyADMIN
  Date: 15/8/30
  Time: 下午4:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
request.setCharacterEncoding("utf-8");
String username=request.getParameter("username")==null?"":new String(request.getParameter("username").getBytes("ISO8859_1"), "utf-8");
    String role = request.getParameter("role")==null?"":new String(request.getParameter("role").getBytes("ISO8859_1"),"UTF-8");
    String sql = null;
    if (role.equals("student")){
        sql="select * from student_login where username='"+username+"'";
    }
    else {
        sql="select * from teacher_login,teacher_reg where username='"+username+"'";
    }
    Connection conn = new databaseUtil().getCon();
    PreparedStatement pstmt = conn.prepareStatement(sql);
    ResultSet rs = pstmt.executeQuery();
    if(rs.next()){
        out.print("false");
    }else{
        out.print("true");
    }
    pstmt.close();
    conn.close();
%>